'use strict';
const { defineConfig } = require('@vue/cli-service')
const path = require('path');
const port = process.env.PORT; // dev port
const name = process.env.NAME;

function resolve(dir) {
  return path.join(__dirname, dir);
}
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: process.env.NODE_ENV === 'production' ? '/h5/' : '/',
  outputDir: 'dist',
  assetsDir: 'static',
  lintOnSave: process.env.NODE_ENV === 'development',
  productionSourceMap: false,
  // webpack-dev-server 相关配置
  devServer: {
    host: '0.0.0.0',
    port: port,
    open: false,
    client:{
      overlay: {
        warnings: false,
        errors: true
      },
    }
    // proxy: {
    //   [process.env.VUE_APP_BASE_API]: {
    //     target: `#`,
    //     changeOrigin: true,
    //     secure: false,
    //     pathRewrite: {
    //       ['^' + process.env.VUE_APP_BASE_API]: ''
    //     }
    //   }
    // },
  },
  configureWebpack:{
    name: name,
    resolve: {
      alias: {
        '@': resolve('src')
      }
    },
    devtool: 'source-map',
  }
})
